import { defineConfig } from 'vite'   //vite的实例
import vue from '@vitejs/plugin-vue'    // 引入vue插件
import AutoImport from 'unplugin-auto-import/vite' // 引入unplugin-auto-import插件 自动引入

import { resolve } from 'path' // 引入path模块 解构出resoleve方法
import Components from 'unplugin-vue-components/vite'
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers' 
import requireTransfom from 'vite-plugin-require-transform'

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [
    vue(),
    AutoImport({
      imports:['vue','vue-router','pinia'],
      resolvers: [ElementPlusResolver()],
    }),
      Components({
        resolvers: [ElementPlusResolver()],
      }),
    requireTransfom(
      { fileRegex: /\.js$|\.ts$|\.vue$/ }
    ),

  ],
  server:{
    proxy:{
      "/api":'http://testapi.xuexiluxian.cn',
      // "/api":'http://192.168.2.6:8021'
    }
  },
    resolve:{
      alias:{
        '@':resolve(__dirname,'./src')
         }
    }
})
